package com.yp.infrastructure.demo.controller;


import com.yp.infrastructure.demo.domain.service.IPartnerService;
import com.yp.infrastructure.demo.model.EnumPartnerType;
import com.yp.infrastructure.demo.model.vo.PartnerVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/customer")
public class CustomerController {

    @Resource
    private IPartnerService partnerService;

    @GetMapping("/list/{owner}")
    public List<PartnerVo> getCustomerList(@PathVariable String owner) {
        return partnerService.getPartnerList(EnumPartnerType.CUSTOMER, owner);
    }


    @PostMapping("/create")
    public void createCustomer(@RequestBody PartnerVo partner) {
        partnerService.createPartner(EnumPartnerType.CUSTOMER, partner);
    }

}
